<? 
	include('base.php');
	User::protect();
	$section = 'admin_users';
	$page_title = 'Add/Edit Users';
	$ul = new UserList();
	$userlist = $ul->get($_GET['entries_per_page'], $_GET['start']);
	$news_total = $ul->getTotal();
	include('layout/header.php');
?>

<div id="breadcrumb">
	<a href="index.php">Audition&nbsp;&#62;</a>&nbsp;<a href="admin.php">Administer Audition&nbsp;&#62;</a>&nbsp;Users
</div>

<?

$u = User::getCurrent();
if (!$u->isAdmin()) { 
	Error::outputDialog('Return to Main Menu', 'index.php', 'Only an administrator may access administrator options.');
} else { 
		if (db::isError($newslist)) {
			$newslist->outputList();
		} 
	?>
	
	<h1>users:</h1>
	<div class="inset">
	<p>
	<form id="amount_form" action="<?=$PHP_SELF?>" method="get">
		<a href="admin_user_add.php">Add User</a><span class="padded">|</span>
		<? include('layout/paging.php'); ?>
	</form>
	</p>
	<p>
	<table class="list" border="0" cellspacing="1" cellpadding="0">
	<tr>
		<td class="header">Username</td>
		<td class="header">Email</td>
		<td class="header">Last Name</td>
		<td class="header">First Name</td>
	</tr>
	<? 
		if (is_array($userlist) && count($userlist) > 0) { 
		foreach ($userlist as $uo) { ?>
		<tr>
			<td valign="top"><a href="admin_user_edit.php?id=<?=$uo->getID()?>"><?=$uo->getUserName()?></a><? if (!$uo->isActive()) { ?> <img src="images/inactive.gif" alt="Entry is Inactive" width="10" height="10" title="Entry is Inactive"><? } ?></td>
			<td valign="top"><a href="mailto:<?=$uo->getEmailAddress()?>"><?=$uo->getEmailAddress()?></a></td>
			<td><?=$uo->getLastName()?></td>
			<td><?=$uo->getFirstName()?></td>
		</tr>				
		<? 
		}
		} else {?>
		<tr>
			<td colspan="4">No entries</td>
		</tr>
	<? }
	?>
	</table>
	</p>		
	</div>
<? } ?>

<? include('layout/footer.php'); ?>
